<?php
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     function.pagination.php
 * Type:     function
 * Name:     link
 * Purpose:  zwraca linki do pozostalych stron z danego zakresu
 * Dependencies: function.url.php
 * -------------------------------------------------------------
 */

/**
 *
 * @param <type> $params
 * @param TemplateMaster $smarty
 * @return <type>
 */
function smarty_function_listCount($params, &$smarty) {

	include_once(dirname(__FILE__) . '/function.url.php');
	$params[ROUTER_PAGE_LABEL] = null;
	$str = '<form method="post" action="' . smarty_function_url($params, $smarty) . '">';

	
	if (($params['type'] & 1) == 1) {
		$str .= '
			<select onchange="this.form.submit()" name="perPage' . (isset($params['iterator']) ? $params['iterator'] : '') . '">
				<option value="10" ' . ($params['selected_1'] == 10 ? 'selected="selected"' : '') . '>10</option>
				<option value="25" ' . ($params['selected_1'] == 25 ? 'selected="selected"' : '') . '>25</option>
				<option value="50" ' . ($params['selected_1'] == 50 ? 'selected="selected"' : '') . '>50</option>
			</select>';
	}

	if (($params['type'] & 2) == 2) {
		$str .= '
			<select onchange="this.form.submit()" name="filter' . (isset($params['iterator']) ? $params['iterator'] : '') . '">
					<option value="3" ' . ($params['selected_2'] == 3 ? 'selected="selected"' : '') . '>wszystkie</option>
					<option value="1" ' . ($params['selected_2'] == 1 ? 'selected="selected"' : '') . '>obciążenia</option>
					<option value="2" ' . ($params['selected_2'] == 2 ? 'selected="selected"' : '') . '>uznania</option>
				</select>
			';
	}

	$str .= '</form>';

	return $str;
}
?>